fix(knowledge): surface KB description validation errors and raise limit to 10k#5347
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Create knowledge base modal: react-hook-form invalid submit now toasts the first validation message (via Edit knowledge base modal: failed client validation toasts the first error instead of returning with no feedback. API contracts: Reviewed by Cursor Bugbot for commit 50b1295. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR standardises the knowledge base description length limit to 10,000 characters via a new shared
Confidence Score: 5/5Safe to merge — all changes are additive validation tightening and UX improvements with no breaking surface. The constant is introduced cleanly and consumed consistently across UI, internal API, and v1 API. The DB column is PostgreSQL TEXT (unbounded), so no migration is needed for the new 10k limit. The react-hook-form wiring is correct — both the form onSubmit path and the footer button onClick path are updated. The edit modal's validate refactor preserves the original behaviour of setting all inline errors while only toasting the first one. No existing data is at risk of truncation because the new cap (10k) is higher than the previous UI/v1 limits (500/1000). No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User types description] --> B{description.length > 10000?}
B -- No --> C[Validation passes]
B -- Yes --> D[Inline field error shown]
D --> E[Toast: first error message]
subgraph Create Modal
C --> F[handleSubmit → onSubmit]
D --> G[handleSubmit → onInvalid callback]
G --> E
end
subgraph Edit Modal
C --> H[validate returns null → handleSubmit proceeds]
D --> I[validate returns error string → toast.error]
end
subgraph API Contracts
F --> J[POST /api/knowledge\ncreateKnowledgeBaseBodySchema\nmax 10k]
F --> K[PUT /api/knowledge/id\nupdateKnowledgeBaseBodySchema\nmax 10k inherited via .pick]
F --> L[POST /api/v1/knowledge\nv1CreateKnowledgeBaseBodySchema\nmax 10k]
F --> M[PUT /api/v1/knowledge/id\nv1UpdateKnowledgeBaseBodySchema\nmax 10k]
end
J & K & L & M --> N[DB: TEXT column — no length cap]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[User types description] --> B{description.length > 10000?}
B -- No --> C[Validation passes]
B -- Yes --> D[Inline field error shown]
D --> E[Toast: first error message]
subgraph Create Modal
C --> F[handleSubmit → onSubmit]
D --> G[handleSubmit → onInvalid callback]
G --> E
end
subgraph Edit Modal
C --> H[validate returns null → handleSubmit proceeds]
D --> I[validate returns error string → toast.error]
end
subgraph API Contracts
F --> J[POST /api/knowledge\ncreateKnowledgeBaseBodySchema\nmax 10k]
F --> K[PUT /api/knowledge/id\nupdateKnowledgeBaseBodySchema\nmax 10k inherited via .pick]
F --> L[POST /api/v1/knowledge\nv1CreateKnowledgeBaseBodySchema\nmax 10k]
F --> M[PUT /api/v1/knowledge/id\nv1UpdateKnowledgeBaseBodySchema\nmax 10k]
end
J & K & L & M --> N[DB: TEXT column — no length cap]
Reviews (1): Last reviewed commit: "fix(knowledge): surface KB description v..." | Re-trigger Greptile |
Summary
KNOWLEDGE_BASE_DESCRIPTION_MAX_LENGTHconstant, enforced consistently across the create/edit UI, the internal API contract, and the v1 API contract (previously 500 / 1000 / uncapped)POST/PUT /api/knowledgegap that had no server-side description cap at allType of Change
Testing
Tested manually.
bun run lint,bun run check:api-validation:strict, andtsc --noEmitall pass.Checklist
🤖 Generated with Claude Code